[PATCH 1/2] lib/pty: Put master PTY into non-blocking mode and buffer its output...
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Tue, 12 Apr 2022 14:25:14 +0000 (16:25 +0200)
committerChris Hofstaedtler <zeha@debian.org>
Fri, 25 Nov 2022 15:19:08 +0000 (15:19 +0000)
commitb66b7795d3b05cc113b9b90a2a498a79fee303e8
tree443467298674a6ceb903055ec961d5c59e6fbf80
parentfbf44086d06902cf70c1535317018f4ee59661c5
[PATCH 1/2] lib/pty: Put master PTY into non-blocking mode and buffer its output to avoid deadlock

If we filled the script->child buffer before the child had a chance to read any
input, we'd sleep forever in write_all(pty->master), and the child would sleep
forever in write(1<pty->slave>)

By putting the master PTY in non-blocking mode, we can poll(pty->master,
POLLOUT) and keep supplying more data as the child reads from the buffer

Fixes Debian bug #1003095

Signed-off-by: Karel Zak <kzak@redhat.com>
Gbp-Pq: Topic upstream
Gbp-Pq: Name PATCH-1-2-lib-pty-Put-master-PTY-into-non-blocking-mode-a.patch
include/pty-session.h
lib/pty-session.c